package leetcode.链表;

/**
 * @author: levi
 * @description: https://leetcode.cn/problems/remove-duplicates-from-sorted-list/
 * @date: 2022-9-14 14:36
 * @version: 1.0
 */
public class 删除排序链表中的重复元素_83 {
    public static void main(String[] args) {
        deleteDuplicates(null);
    }

    public static ListNode deleteDuplicates(ListNode head) {
        if(head == null) return head;
        ListNode index = head;
        while (index.next != null){
            if(index.val == index.next.val){
                index.next = index.next.next;
            }else {
                index = index.next;
            }
        }
        return head;
    }
}
